<?php

namespace App\Admin\Controllers;

use App\Facades\AdminC;
use App\Http\Controllers\Controller;
use App\Models\CapitalLog;
use Encore\Admin\Controllers\ModelForm;
use Encore\Admin\Grid;
use Encore\Admin\Layout\Content;

class CapitalController extends Controller
{
    use ModelForm;

    public function index()
    {
        return AdminC::content(function(Content $content){
            $content->header('资金明细');
            $content->description('列表');
            $content->body($this->grid());
        });
    }

    protected function grid()
    {
        return AdminC::grid(CapitalLog::class, function(Grid $grid){
            $grid->filter(function($filter){
                $filter->equal('member_id','用户id');
            });
            $grid->column('','');
            $grid->id('流水号');
            $grid->column('','类型')->display(function($type_id){
                return $type_id;
            });
            $grid->member_id('用户Id');
            $grid->column('g_member.name','用户名');
            $grid->money('金币');
            $grid->money_cash('现金');
            $grid->bei('备注');
            $grid->created_at('时间');

            $grid->disableRowSelector();
            $grid->disableExport();
            $grid->disableActions();
        });
    }

}
